{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">发票列表</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"
               data-auth-add="{:$auth->check('invoiceb.invoiceb/add')}"
               data-auth-edit="{:$auth->check('invoiceb.invoiceb/edit')}"
               data-auth-delete="{:$auth->check('invoiceb.invoiceb/del')}"
        ></table>
    </div>
</div>

<script type="text/html" id="barTool">
    <a data-open='{:url("edit")}?id={{ d.id }}' class="layui-btn layui-btn-xs {:$auth->check('invoiceb.invoiceb/edit')?'':'layui-hide'}" title="编辑"><i class='iconfont icon-brush_fill'>发票详情</i></a>
</script>


<!--操作模板-->

{/block}
{block name="script"}
<script>

    layui.use(['yznTable', 'table'], function () {
        var table = layui.yznTable;
        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: "{:url('add')}",
            edit_url: "{:url('edit')}",
            delete_url: "{:url('del')}",
        };
        table.render({
            elem: '#currentTable',
            init: init,
            autoWidth: true,
            toolbar: ['refresh', [{
                html: ' {if $status==0}<a class="layui-btn layui-btn-sm confirm" data-href="{:url("ca")}" data-batch-all="currentTable"><i class="iconfont icon-right"></i>选择开票</a> {/if}',
                auth: 'pass',
            }]],
            url: '{:url("index")}?status={$status}',
            // search: false,
            cols: [
                [
                    //1直接购买订单 2购买水票订单  type
                    {type: 'checkbox', fixed: 'left'},
                    {field: 'id', width: 50, title: 'ID', search: false},
                    {field: 'b_name',align: 'center', Width: 120, title: '所属服务站'},
                    {field: 'count_amount',align: 'center', Width: 120, title: '订单金额', search: false},
                    {field: 'date',align: 'center', Width: 120, title: '订货日期', search: false},
                    {field: 'create_time',align: 'center', Width: 150, title: '申请时间', search: 'range'},
                    {fixed: 'right', align: 'center', Width: 50, title: '操作', toolbar: '#barTool'}//delete'
                ]
            ],
            page: {}
        });
        table.bindevent();
    });
</script>
{/block}